package com.shiro.test.response;

public class Response<T> {
    // http 状态码
    private int code;

    // 返回信息
    private String msg;

    // debugMsg;
    private String debugMsg;

    // 返回的数据
    private T data;

    public Response(){}


    public Response success(T data){
        return new Response(200, "成功", null, data);
    }

    public Response fail(String msg, String debugMsg){
        return new Response(200, msg, debugMsg, null);
    }

    public Response(int code, String msg, String debugMsg, T data) {
        this.code = code;
        this.msg = msg;
        this.debugMsg = debugMsg;
        this.data = data;
    }

    public int getCode() {
        return code;
    }

    public Response setCode(int code) {
        this.code = code;
        return this;
    }

    public String getMsg() {
        return msg;
    }

    public Response setMsg(String msg) {
        this.msg = msg;
        return this;
    }

    public T getData() {
        return data;
    }

    public Response setData(T data) {
        this.data = data;
        return this;
    }

    public String getDebugMsg() {
        return debugMsg;
    }

    public Response setDebugMsg(String debugMsg) {
        this.debugMsg = debugMsg;
        return this;
    }
}
